package com.gz.spring.aop.xml;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.Signature;

import java.util.Arrays;


//xml方法配置切面类

public class FuncAspect {

    public  void showBeginLog(JoinPoint joinPoint) {
        Signature signature = joinPoint.getSignature();
        System.out.println("XML配置-切面类的showBeginLog-方法执行前-日志-方法名-" +signature.getName()+
                "-参数"+ Arrays.toString(joinPoint.getArgs()));//从AOP看，这里是一个横切关注点-前置通知
    }


    public  void showSuccessEndLog(JoinPoint joinPoint,Object res) {
        Signature signature = joinPoint.getSignature();
        System.out.println("XML配置-切面类的showSuccessEndLog-方法正常使用结束-日志-方法名-"+
                signature.getName()+"-执行结果="+res);//从AOP看，也是一个横切关注点-返回通知
    }


    public  void showExceptionLog(JoinPoint joinPoint,Exception e) {
        Signature signature = joinPoint.getSignature();
        System.out.println("XML配置-切面类的showExceptionLog-方法出现异常-日志-方法名-"+signature.getName()
                +"-异常信息="+e);//从AOP看，也是一个横切关注点-异常通知
    }


    public  void showFinallyEndLog(JoinPoint joinPoint){
        Signature signature = joinPoint.getSignature();
        System.out.println("XML配置-切面类的showFinallyEndLog-方法最终执行完毕-日志-方法名-"+signature.getName());//从AOP看，也是一个横切关注点-最终通知
    }
}
